<?php
class CreateCustomer {
  public $Title; // string
  public $FirstName; // string
  public $LastName; // string
  public $Address; // string
  public $Suburb; // string
  public $State; // string
  public $Company; // string
  public $PostCode; // string
  public $Country; // string
  public $Email; // string
  public $Fax; // string
  public $Phone; // string
  public $Mobile; // string
  public $CustomerRef; // string
  public $JobDesc; // string
  public $Comments; // string
  public $URL; // string
  public $CCNumber; // string
  public $CCNameOnCard; // string
  public $CCExpiryMonth; // int
  public $CCExpiryYear; // int
}

class CreateCustomerResponse {
  public $CreateCustomerResult; // string
}

class eWAYHeader {
  public $eWAYCustomerID; // string
  public $Username; // string
  public $Password; // string
}

class UpdateCustomer {
  public $managedCustomerID; // long
  public $Title; // string
  public $FirstName; // string
  public $LastName; // string
  public $Address; // string
  public $Suburb; // string
  public $State; // string
  public $Company; // string
  public $PostCode; // string
  public $Country; // string
  public $Email; // string
  public $Fax; // string
  public $Phone; // string
  public $Mobile; // string
  public $CustomerRef; // string
  public $JobDesc; // string
  public $Comments; // string
  public $URL; // string
  public $CCNumber; // string
  public $CCNameOnCard; // string
  public $CCExpiryMonth; // int
  public $CCExpiryYear; // int
}

class UpdateCustomerResponse {
  public $UpdateCustomerResult; // boolean
}

class QueryCustomer {
  public $managedCustomerID; // long
}

class QueryCustomerResponse {
  public $QueryCustomerResult; // CreditCard
}

class CreditCard {
  public $CCName; // string
  public $CCNumber; // string
  public $CCExpiryMonth; // string
  public $CCExpiryYear; // string
}

class ManagedCustomer {
  public $ManagedCustomerID; // long
  public $CustomerRef; // string
  public $CustomerTitle; // string
  public $CustomerFirstName; // string
  public $CustomerLastName; // string
  public $CustomerCompany; // string
  public $CustomerJobDesc; // string
  public $CustomerEmail; // string
  public $CustomerAddress; // string
  public $CustomerSuburb; // string
  public $CustomerState; // string
  public $CustomerPostCode; // string
  public $CustomerCountry; // string
  public $CustomerPhone1; // string
  public $CustomerPhone2; // string
  public $CustomerFax; // string
  public $CustomerURL; // string
  public $CustomerComments; // string
}

class QueryCustomerByReference {
  public $CustomerReference; // string
}

class QueryCustomerByReferenceResponse {
  public $QueryCustomerByReferenceResult; // CreditCard
}

class ProcessPayment {
  public $managedCustomerID; // long
  public $amount; // int
  public $invoiceReference; // string
  public $invoiceDescription; // string
}

class ProcessPaymentResponse {
  public $ewayResponse; // CCPaymentResponse
}

class CCPaymentResponse {
  public $ewayTrxnError; // string
  public $ewayTrxnStatus; // string
  public $ewayTrxnNumber; // string
  public $ewayReturnAmount; // string
  public $ewayAuthCode; // string
}

class QueryPayment {
  public $managedCustomerID; // long
}

class QueryPaymentResponse {
  public $QueryPaymentResult; // ArrayOfManagedTransaction
}

class ManagedTransaction {
  public $TotalAmount; // int
  public $Result; // int
  public $ResponseText; // string
  public $TransactionDate; // dateTime
  public $ewayTrxnNumber; // int
}


/**
 * ManagedCreditCardPaymentTest class
 *
 *
 *
 * @author    {author}
 * @copyright {copyright}
 * @package   {package}
 */
class ManagedCreditCardPaymentTest extends SoapClient {

  private static $classmap = array(
                                    'CreateCustomer' => 'CreateCustomer',
                                    'CreateCustomerResponse' => 'CreateCustomerResponse',
                                    'eWAYHeader' => 'eWAYHeader',
                                    'UpdateCustomer' => 'UpdateCustomer',
                                    'UpdateCustomerResponse' => 'UpdateCustomerResponse',
                                    'QueryCustomer' => 'QueryCustomer',
                                    'QueryCustomerResponse' => 'QueryCustomerResponse',
                                    'CreditCard' => 'CreditCard',
                                    'ManagedCustomer' => 'ManagedCustomer',
                                    'QueryCustomerByReference' => 'QueryCustomerByReference',
                                    'QueryCustomerByReferenceResponse' => 'QueryCustomerByReferenceResponse',
                                    'ProcessPayment' => 'ProcessPayment',
                                    'ProcessPaymentResponse' => 'ProcessPaymentResponse',
                                    'CCPaymentResponse' => 'CCPaymentResponse',
                                    'QueryPayment' => 'QueryPayment',
                                    'QueryPaymentResponse' => 'QueryPaymentResponse',
                                    'ManagedTransaction' => 'ManagedTransaction',
                                   );

  public function ManagedCreditCardPaymentTest($wsdl = "https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx?WSDL", $options = array()) {
    foreach(self::$classmap as $key => $value) {
      if(!isset($options['classmap'][$key])) {
        $options['classmap'][$key] = $value;
      }
    }
    parent::__construct($wsdl, $options);
  }

//  function __doRequest($request, $location, $action, $version){
//  	var_dump($request);
//  	return parent::__doRequest($request, $location, $action, $version);
//  }

  public function create_customer(CreateCustomer $new_customer, eWAYHeader $eWAYheader){
  	 $header = new SoapHeader('https://www.eway.com.au/gateway/managedpayment', 'eWAYHeader', $eWAYheader);
  	  return $this->__soapCall('CreateCustomer', array($new_customer), NULL, $header);
  }

}

?>
